using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NTTHAO.CommonWeb;
using System.IO;

public partial class admin_ImgListProvider : System.Web.UI.Page
{
    public string[] _UploadedFilesList = new string[0];
    public bool[] _IsImageFiles = new bool[0];
    public string[] _UploadedFilesExtention = new string[0];

    protected void Page_Load(object sender, EventArgs e)
    {
        NTTHAO.CommonWeb.LanguageUtility.CheckLanguage(Request, Response, Session);

        try
        {
            string[] allFileList = Directory.GetFiles(Server.MapPath("../" + Constant.UPLOAD_FILE_PATH.TrimEnd('/') + "/Files/"));

            int imgCount = 0;
            for (int i = 0; i < allFileList.Length; i++)
            {
                string ex = Path.GetExtension(allFileList[i]).ToLower();
                if (Constant.IMAGE_FILE_EXTENTIONS.Contains(ex))
                {
                    imgCount++;
                }
            }

            _UploadedFilesList = new string[imgCount];
            _IsImageFiles = new bool[imgCount];
            _UploadedFilesExtention = new string[imgCount];

            int imgIndex = 0;
            for (int i = 0; i < allFileList.Length; i++)
            {
                string ex = Path.GetExtension(allFileList[i]).ToLower();

                if (Constant.IMAGE_FILE_EXTENTIONS.Contains(ex))
                {
                    _UploadedFilesList[imgIndex] = Path.GetFileName(allFileList[i]);
                    _UploadedFilesExtention[imgIndex] = ex;
                    _IsImageFiles[imgIndex] = true;
                    imgIndex++;
                }
            }
        }
        catch (Exception)
        {
        }
    }
}
